<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    html,body{
      margin: 0;
      padding: 0;
    }
    .wrap {
      width:100%;
      padding: 0 8%;
      box-sizing: border-box;
    }
    .wrap .title {
      width: 34%;
      margin: 20px auto;
      text-align: center;
    }
    .wrap .title h5{
      font-size: 26px;
      margin-block-start: 1em;
      margin-block-end: 1em;
    }
    .wrap .content {
      display: flex;
      justify-content: space-between;
    }
    .wrap .content .middle {
      width: 38%;
      margin: 0 4%;
      text-align: center;
    }
    .wrap .content .img-box {
      margin: 0 auto 4%;
      padding: 0 14%;
    }
    @keyframes img-show {
      from {opacity: 0.5;}
      to {opacity: 1;}
    }
    @keyframes img-show2 {
      from {opacity: 0.5;}
      to {opacity: 1;}
    }
    .wrap .content .img-box img{
      width: 100%;
      animation-name: img-show;
      animation-duration: 1s;
      /* animation: img-show .8s; */
    }
    .wrap .content .left, .wrap .content .right {
      width: 31%;
    }
    .wrap .content .item {
      /* margin: 26% 0 36%; */
      padding: 15% 0 46%;
      position: relative;
    }
    @media screen and (max-width:1200px) {
      .wrap .content .item {
          padding-bottom: 56%;
      }
    }
    .wrap .content .item p{
      position: absolute;
    }
    .wrap .content .item .sub-title{
      position: relative;
      color: #c95c3d;
      font-weight: bold;
      cursor: pointer;
    }
    .wrap .content .item .sub-title:after{
      content: '';
      position: absolute;
      width: 100%;
      height: 1px;
      left: 0;
      bottom: 0;
      background-color: transparent;
    }
    .wrap .content .item .sub-title:hover:after{
      background-color: #c95c3d;
    }
    .wrap .content .item .sub-title.active:hover:after{
      background-color: #000;
    }
    .wrap .content .item .sub-title.active{
      color: #000;
    }
    @media screen and (max-width:980px) {
      .wrap .title {
        width: 48%;
        margin: 20px auto;
        text-align: center;
      }
      .wrap .content .item {
          padding-bottom: 90%;
      }
    }
  </style>
</head>
<body>
  <div class="wrap">
    <div class="title">
      <h5>a title for this section</h5>
      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptate reiciendis, aliquid impedit reprehenderit sapiente est ipsam totam delectus natus dolorem dignissimos molestias quod ducimus rem deleniti consectetur facilis blanditiis voluptates?</p>
    </div>
    <div class="content">
      <div class="left">
        <div class="item">
          <span class="sub-title" data-img="w1">show first image</span>
          <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae alias architecto libero at nihil aspernatur doloribus est delectus cum facilis non inventore dolores cupiditate, illo natus tempora repellendus pariatur quo.</p>
        </div>
        <div class="item">
          <span class="sub-title" data-img="w2">show second image</span>
          <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Id facilis cupiditate, ipsum nisi expedita magni nihil distinctio neque odio velit commodi necessitatibus atque dignissimos molestias eum? Error tempora est iusto.</p>
        </div>
      </div>
      <div class="middle">
        
        <div class="img-box">
          <img src="./images/w5.png">
        </div>
        <div class="item">
          <span class="sub-title active" data-img="w5">show fifth image</span>
          <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Incidunt, laborum odio eveniet est voluptatem reiciendis distinctio laboriosam quo explicabo necessitatibus earum laudantium! Vero voluptas alias molestiae voluptate ipsum ut qui.</p>
        </div>
      </div>
      <div class="right">
        <div class="item">
          <span class="sub-title" data-img="w3">show third image</span>
          <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam nemo odio dolore voluptas, velit fugiat at quo quia consequuntur earum nobis voluptatum deserunt, aliquid, assumenda itaque tempora illo iusto dolorum.</p>
        </div>
        <div class="item">
          <span class="sub-title" data-img="w4">show forth image</span>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio voluptatibus rem, earum perferendis nemo fuga consectetur eos commodi nesciunt inventore architecto ut quia! Voluptatum nobis nam rerum? Corrupti, laboriosam vel.</p>
        </div>
      </div>
    </div>
  </div>
  <script>
    let tits = document.querySelectorAll('.sub-title');
    let img = document.querySelector('.middle .img-box img');
    document.querySelector('.wrap .content').addEventListener('click',(e) => {
      let target = e.target || e.srcElement
      // console.log(target)
      if(target.nodeName.toLowerCase() == "span") {
        for (let i = 0; i < tits.length; i++) {
          tits[i].classList.remove('active')
        }
        target.classList.add('active')
        img.src=`./images/${target.getAttribute('data-img')}.png`;
        if (window.getComputedStyle(img,null).animationName=='img-show') {
          img.style.animationName='img-show2'
        } else {
          img.style.animationName='img-show'
        }
      }
    })
  </script>
</body>
</html>